<?php

use Illuminate\Database\Seeder;

class CustomMemberGenerateSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // 创建一个商户
        $member = \App\B2BProject\Custom\Member::create([
            'user'     => 'test01',
            'password' => bcrypt('123456'),
            'email'    => 'test01@test.com',
            'class' => 1
        ]);

        // 创建 USER INFO
        $member->information()->save(\App\B2BProject\Custom\MemberInformation::create([
            'company'          => '测试公司',
            'legal'            => '测试法人',
            'legal_gender'     => 0,
            'legal_identity_a' => 1,
            'legal_identity_b' => 2,
            'region'           => '测试地区',
            'address'          => '测试地址',
            'contact_person'   => '测试联系人',
            'contact_phone'    => '12345678910',
            'contact_email'    => 'test01@test.com',
            'business_license' => 3
        ]));

        $member->store()->save(\App\B2BProject\Custom\Business\Store::create([
            'tax_registration' => 4,
            'organization_code_cert' => 5,
        ]));

        $member->store->authorizations()->save(\App\B2BProject\Custom\Business\ProviderAuthorization::create(['authorization' => 6]));
        $member->store->authorizations()->save(\App\B2BProject\Custom\Business\ProviderAuthorization::create(['authorization' => 7]));
    }
}
